Skip to content

Conversation

@tcare
Copy link
Contributor

@tcare tcare commented Dec 14, 2016

Fixes OS 9357224.

Array.prototype.unshift prepends array values to 'this' array by calling JavascriptArray::FillFromArgs. FillFromArgs makes the assumption that values are already marshalled to the same context as 'this'. It is possible to have a situation in Array.prototype.unshift where the source array is in another context than the parameters passed in, triggering the assert. Other users of FillFromArgs (e.g. new Array()) don't seem to be able to hit this situation. Fix is to marshal values as we iterate in FillFromArgs.

@tcare
Copy link
Contributor Author

tcare commented Dec 14, 2016

@pleath @aneeshdk please review

@pleath
Copy link
Contributor

pleath commented Dec 14, 2016

LGTM. Thanks.

@tcare
Copy link
Contributor Author

tcare commented Dec 14, 2016

It looks like Akrosh fixed this in #2134 but did not merge it. He takes a slightly different approach, by avoiding the if (JavascriptArray()) path if we have a cross site object. I am fine with either fix, do you have any preference?

@dilijev
Copy link
Contributor

dilijev commented Dec 14, 2016

I like this PR because it includes a test (and Akrosh is on vacation until the new year) -- but of course, you could adopt his change if you decided that was the better approach.

@dilijev
Copy link
Contributor

dilijev commented Dec 20, 2016

@tcare Should this be retargeted to release/1.4?

@tcare
Copy link
Contributor Author

tcare commented Dec 20, 2016

Yes, you're right. I will await Paul's additional offline signoff and push there.

@tcare
Copy link
Contributor Author

tcare commented Jan 6, 2017

After speaking with Curtis, Akrosh's fix in #2134 is correct. I will check that in.

@dilijev
Copy link
Contributor

dilijev commented Jan 6, 2017

Maybe update this PR to defer to that fix but still add the tests?

@tcare
Copy link
Contributor Author

tcare commented Jan 6, 2017

Yep that's what 348cd33 is :)

@dilijev
Copy link
Contributor

dilijev commented Jan 6, 2017

@tcare oh gotcha, didn't notice the update

return res;
}
if (JavascriptArray::Is(args[0]))
if (JavascriptArray::Is(args[0]) && !JavascriptArray::FromVar(args[0])->IsCrossSiteObject())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is still present in this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's Akrosh's fix. Mine was in FillFromArgs.

Copy link
Contributor

@dilijev dilijev Jan 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I guess it will just merge down. Anyway you'll want to retarget this PR to release/1.4 and rebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I missed this targeted master. Will update

@tcare tcare changed the base branch from master to release/1.4 January 6, 2017 20:03
@dilijev
Copy link
Contributor

dilijev commented Jan 6, 2017

You can now resolve the CI issues as described here: #2332 (comment)

Fixes OS 9357224.

Array.prototype.unshift does not take the slow path if 'this' is a cross-site object.
@chakrabot chakrabot merged commit e193897 into chakra-core:release/1.4 Jan 7, 2017
chakrabot pushed a commit that referenced this pull request Jan 7, 2017
…ers correctly

Merge pull request #2201 from tcare:unshift

Fixes OS 9357224.

Array.prototype.unshift prepends array values to 'this' array by calling JavascriptArray::FillFromArgs. FillFromArgs makes the assumption that values are already marshalled to the same context as 'this'. It is possible to have a situation in Array.prototype.unshift where the source array is in another context than the parameters passed in, triggering the assert. Other users of FillFromArgs (e.g. new Array()) don't seem to be able to hit this situation. Fix is to marshal values as we iterate in FillFromArgs.
chakrabot pushed a commit that referenced this pull request Jan 7, 2017
…rshal parameters correctly

Merge pull request #2201 from tcare:unshift

Fixes OS 9357224.

Array.prototype.unshift prepends array values to 'this' array by calling JavascriptArray::FillFromArgs. FillFromArgs makes the assumption that values are already marshalled to the same context as 'this'. It is possible to have a situation in Array.prototype.unshift where the source array is in another context than the parameters passed in, triggering the assert. Other users of FillFromArgs (e.g. new Array()) don't seem to be able to hit this situation. Fix is to marshal values as we iterate in FillFromArgs.
@akroshg
Copy link
Contributor

akroshg commented Jan 9, 2017

@tcare thanks for taking care of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants